package WaiBao;

import java.util.Arrays;

public class LiSiQi {
    public static void main(String[] args) {
        String[] name= {"郭俊良(班长)", "李浩生(副班长)", "小李(学习委员)", "李打车(团支书)", "王志宝", "马夫", "马付琼", "马福", "马俊", "马燕", "马克", "王凯",
                "王强", "王皓", "王豪", "张起名", "戴启明", "张小虎", "徐金明", "徐明远", "李互补", "彭英", "彭颖", "彭莹", "向上", "向阳", "杨洋", "郑爽",
                "程依娜", "李斯琪(学生)"};//考生本人:李斯琪(学生)
        int[] age = {20, 21, 22, 20,22, 21, 20, 20, 18, 22,19, 21, 18, 19, 21,20, 18, 18, 18, 18, 19, 19, 20, 20, 20, 21, 19,20,20, 21};//考生年龄：21岁

        double[] zhao1 = {89, 66, 84, 91, 61, 71, 88, 88, 77, 91, 83, 77, 85, 77, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 88, 76, 88, 95};
        double[] zhao2 = {68, 74, 84, 76, 75, 82, 88, 89, 94, 80, 91, 87, 84, 75, 65, 65, 86, 79, 66, 68, 82, 71, 90, 86, 75, 80, 76, 85, 94, 95};
        double[] zhao3 = {74, 66, 91, 84, 75, 69, 78, 89, 80, 68, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 85, 95, 79, 84, 77, 74, 89, 96};



        double guan1;//代表每个学生的总分
        double guan2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            guan1 = zhao1[i] + zhao2[i] +zhao3[i];
//            guan2 = (guan1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + guan1);
//            System.out.println(name[i] + "的平均分为:" +guan2);
//        }


        double sougou1 = 0, sougou2 = 0;
        double[] star = new double[30];
        for (int i = 0; i < 30; i++) {
            sougou1 = zhao1[i] + zhao2[i] +zhao3[i];
            sougou2= (sougou1 * 1.0) / 3;
            star[i] = sougou2;
        }

        for (int i = 0; i < star.length - 1; i++) {
            for (int j = 0; j <star.length - i - 1; j++) {
                if (star[j] < star[j + 1]) {
                    double tep =star[j];
                    star[j] =star[j + 1];
                    star[j + 1] = tep;
                }
            }
        }
        System.out.println("前十名同学的成绩为:");
        for (int i = 0; i < 10; i++) {
            System.out.println(star[i]);
        }


        double shikang1 = 0,shikang2 = 0, shikang3 = 0;//计算每门课的平均分
        double maoyuan1 = 0,maoyuan2 = 0, maoyuan3 = 0;//计算每门课标准差
        double shijian1 = 0,shijian2 = 0,shijian3 = 0;//计算每门课中位数
        double sum2 = 0;
//        for (int i = 0; i <zhao1.length; i++) {
//            sum2+=zhao1[i];
//        }
//        shikang1 = (sum2*1.0)/30;
//        System.out.println("生物化学的班级平均分为:"+shikang1);
//        double Sum = 0;
//        for (int i = 0; i <zhao2.length; i++) {
//            Sum+=zhao2[i];
//        }
//        shikang2 = (Sum*1.0)/30;
//        System.out.println("微生物学的班级平均分为:"+shikang2);
//        double sum = 0;
//        for (int i = 0; i <zhao3.length; i++) {
//            sum+=zhao3[i];
//        }
//        shikang3 = (sum*1.0)/30;
//        System.out.println("人体组织解剖学的班级平均分为:"+shikang3);
//
//
////
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i <zhao1.length; i++) {
//            c1+= (zhao1[i] -shikang1)*(zhao1[i] - shikang1);
//        }
//        maoyuan1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:"+maoyuan1);
//
//        for (int i = 0; i < zhao2.length; i++) {
//            c2+= (zhao2[i] -shikang2)*(zhao2[i] - shikang2);
//        }
//        maoyuan2 = Math.sqrt(c2*1.0/30);
//        System.out.println("微生物学的班级标准差为:"+maoyuan2);
//
//        for (int i = 0; i <zhao3.length; i++) {
//            c3+= (zhao3[i] -shikang3)*(zhao3[i] - shikang3);
//        }
//        maoyuan3 = Math.sqrt(c3*1.0/30);
//        System.out.println("人体组织解剖学的班级标准差为:"+maoyuan3);
//////
//////
        Arrays.sort(zhao1);
        Arrays.sort(zhao2);
        Arrays.sort(zhao3);
        shijian1 =( zhao1[14]+zhao1[15])*1.0/2;
        shijian2 =(zhao2[14]+zhao2[15])*1.0/2;
        shijian3 =( zhao3[14]+zhao3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+ shijian1);
        System.out.println("微生物学的中位数为:"+ shijian2);
        System.out.println("人体组织解剖学的中位数为:"+ shijian3);



    }
}
